home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / graphics / rvga01.zip / T_EXP-01.C < prev    next >
C/C++ Source or Header  |  1994-08-10  |  2KB  |  87 lines

  1. /**********************************************
  2.  
  3.     Example #01 for the Reglage VGA-Library
  4.  
  5.         TEXT MODE
  6.         Palette Experimenting
  7.  
  8.     V1.0 - Reglage (C) 1994
  9.  
  10. **********************************************/
  11.  
  12. #include "Keyb.h"
  13. #include "VGA.h"
  14. #include "VGA_T.h"
  15.  
  16.  
  17. /**********************************************
  18.  
  19.     main() ... Just a little test!
  20.  
  21. **********************************************/
  22.  
  23. int main(void)
  24. {
  25.     struct Palette OldPalette[16];
  26.     struct Palette NewPalette[16]=
  27.     {
  28.         { 0x00,0x00,0x00 },
  29.         { 0x08,0x00,0x1c },
  30.         { 0x00,0x1c,0x08 },
  31.         { 0x08,0x18,0x1c },
  32.         { 0x20,0x00,0x00 },
  33.         { 0x1c,0x04,0x1c },
  34.         { 0x20,0x14,0x18 },
  35.         { 0x1a,0x1a,0x1a },
  36.         { 0x0e,0x0e,0x0e },
  37.         { 0x08,0x18,0x3f },
  38.         { 0x00,0x3a,0x00 },
  39.         { 0x00,0x3a,0x3a },
  40.         { 0x3a,0x00,0x00 },
  41.         { 0x3f,0x00,0x30 },
  42.         { 0x3f,0x38,0x10 },
  43.         { 0x3f,0x3f,0x3f }
  44.     };
  45.  
  46.     UWORD i,x,y;
  47.  
  48.     V_SetMode(3);                        // Set TextMode 80X25
  49.  
  50.     for(i=0;i<16;i++)
  51.     {
  52.         T_GetPal(i,&OldPalette[i]);//    Store Old Palette
  53.         T_SetPal(i,&NewPalette[i]);//    Setup New Palette
  54.     }
  55.  
  56.     T_SetCursor(0);                    //    Set Cursor Invisible
  57.  
  58.     for(y=0;y<8;y++)                    //    Output Color Table
  59.         for(x=0;x<16;x++)
  60.         {
  61.             T_attr=(x<<8)+(y<<12);                //    Set Attribute
  62.             T_OutByte(x*2+25,y+5,x+y*16,0);    //    Write Attribute #
  63.         }
  64.  
  65.     T_attr=0x1e00;                        //    Set Nice Attribute Color
  66.                                             //    and Write Nice Text
  67.     T_String(22,0," Copyright (C) 1994 Reglage Software ");
  68.  
  69.     T_attr=0x8c00;                        //    Flash text...
  70.     T_String(32,16,"Press the ANY Key");
  71.  
  72.     K_EatKbHit();                        //    Eat Keypress
  73.     while(K_KbHit());                    //    Wait for Keypress
  74.     K_EatKbHit();                        //    Eat Keypress
  75.  
  76.     T_String(32,16,"                 ");
  77.     for(i=0;i<16;i++)
  78.     {
  79.         T_SetPal(i,&OldPalette[i]);//    Restore Original Palette
  80.     }
  81.  
  82.     T_SetCursor(2);                    //    Restore Cursor
  83.     T_SetCursorPos(0,16);            //    Set New Cursor Position
  84.  
  85.     return 0;
  86. }
  87.